home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2001 Haziran
/
CHIP Haziran2001.iso
/
prog
/
share
/
04
/
setup.exe
/
MM27.Cab
/
F856_JSA.h.0162E57D_7C98_4D94_A1CA_6231808F03E6
< prev
next >
Wrap
Text File
|
2000-09-14
|
5KB
|
153 lines
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2000 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of
* Adobe Systems Incorporated and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe Systems
* Incorporated a nd its suppliers and may be covered by U. S. and Foreign
* Patents,patents in process,and are protected by trade secret or copyright
* law. Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained from
* Adobe Systems Incorporated.
*
**************************************************************************/
// ----------------------------------------------------------------
// JSA++.h
// Definitions for the GoLive Extend Script SDK
// ----------------------------------------------------------------
#ifndef _JSAPP_H_
#define _JSAPP_H_
/* The JSA Javascript Interface
This interface needs the include files for the ExtendScript interpreter. As opposed to the plain
C interface, full access to the values and the runtime engine is provided. The ExtendScript headers
can be found in an update to the SDK. To receive the latest version of the Extend Script SDK,
please check the GoLive pages on www.adobe.com.
The JSA interface permits developers to write binary code extensions for the Extend Script SDK.
All modules must reside in the Extend Script subdirectory Common, and all functions are callable by all
Javascript extension modules. The functions are accessible as parts of a Javscript object
which has the same name as the DLL or SharedLib. If, for example, the DLL is called "SomeExt.DLL",
and it contains a function "foo", the function is callable as "SomeExt.foo()".
See the documentation for further information.
When writing a module, it is important to implement the macro JSA_INIT once which defines some data
structures and perfoms the necessary initialization of the module.
*/
/// This header file needs the ExtendScript headers.
#include "ExtendScript.h"
extern "C" {
#ifdef WIN32
#define JSAEXPORT __declspec(dllexport)
#else
#define JSAEXPORT
#endif
struct JSAEnv;
/**
The JSAMain function is called from within the JSA_INIT macro. It should be used
to register all functions callable by the Extend Script SDK. It is called when the
module has been loaded, which the SDK does on demand before calling the first
function inside the module.
*/
extern void JSAEXPORT JSAMain(void);
/**
The JSAExit function is called when the extension module is about to be unloaded.
Here, the module may be deinitialized.
*/
extern void JSAEXPORT JSAExit(void);
/**
All callable functions must be encoded as JSANativeMethods. They receive
an argc/argv combination as well as a location to store the return value.
@param argc the number of arguments
@param argv the argument vector as pointer to sValue instances
@param retval a location to store any return value, preset to undefined
*/
typedef void (*JSANativeMethod)(int argc, const sValue* argv[], sValue* returnValue);
/**
Register a function by name within the Javascript extension. Only registered functions can
be called from within the Javascirpt extension modules. The function must be a JSANativeMethod.
The location to register functions is within the JSAMain() function.
@param n the function name. The name must follow Javascript naimg conventions.
@param f the function itself (a JSANativeMethod)
*/
#define JSARegisterFunction(n,f) JSAEnvObj->regFct(JSAEnvObj,n,f)
/**
Retrieve a pointer to the currently running engine. This engine may belong to any active module.
It is, however, the engine which called the current function.
@return a pointer to the current engine.
*/
#define JSAGetEngine() (sEngine*) JSAEnvObj->jsaInst
/**
The structure supplied to allow for drawing inside a module.
The Draw.getDrawInfo() method of the Extend Script SDK returns a long value which is really a
pointer to a JSADrawInfo structure. The pointer may be retrieved by JSAValueToInt() and casted
to a JSADrawInfo structure. The contents of the structure can be used to implement drawing
in native code.
*/
struct JSADrawInfo
{
/// The device context. This is a DC handle on Windows or a GrafPtr pointer on the Mac.
long context;
/// The top left corner of the current drawing area.
long left, top;
/// The bottom right corner of the current drawing area.
long right, bottom;
};
// ////////////////////////////////////////////////////////////////////////////
typedef void (*JSARegisterFunctionFct)(JSAEnv *, const char *name, JSANativeMethod);
struct JSAEnv
{
long jsaStructSize;
long jsaVersion;
void * jsaInst;
void * externalRef;
void * internal[9];
JSARegisterFunctionFct regFct;
};
// ---------- Implementation ----------------
extern JSAEnv *JSAEnvObj;
extern void JSAEXPORT JSAEntry(JSAEnv *env);
#define JSA_INIT \
\
JSAEnv *JSAEnvObj; \
\
void main() \
{ \
} \
\
void JSAEXPORT JSAEntry(JSAEnv *env) \
{ \
JSAEnvObj = env; \
JSAMain(); \
} \
}
#endif